import { createRouter, createWebHistory } from 'vue-router'
import Layout from '../views/Layout.vue'
import User from '../views/User.vue'
import Home from '../views/Home.vue'
import Article from '../views/Article.vue'
import Notify from '../views/Notify.vue'
import Login from '../views/Login/index.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  // 3. 配置路由规则
  /*
    / 根目录(布局容器)
    /login  登陆 
    /user   我的
    /home   首页
    /article  文章列表
    /notify  消息通知
  */

  routes: [
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: 'user',
          name: 'User',
          component: User
        },
        {
          path: 'home',
          name: 'Home',
          component: Home
        },
        {
          path: 'article',
          name: 'Article',
          component: Article
        },
        {
          path: 'notify',
          name: 'Notify',
          component: Notify
        }
      ]
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    }
  ]
})

export default router
